<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>

<body>
	<button onclick="img_SET()">点击</button>
</body>

</html>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
	var data = [{
		"product_id": "3419420455646431007",
		"product_name": "男装 工装七分裤(卷边) 425146 优衣库UNIQLO",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/049963cc35d7dc71728b72b6f5a1886107d5c9b0www1000-1000"
	}, {
		"product_id": "3420553588420785995",
		"product_name": "简优 2020新款法式复古一字肩长裙性感收腰超仙甜美气质连衣裙女",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/72595e8809d4fac2c2e89e7904a64b4cd4d87dffwww900-1198"
	}, {
		"product_id": "3421990680183064559",
		"product_name": "v领白色衬衣女短袖百搭气质工作服职业工装OL面试面试公务员衬衫",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/ccaa2ebb39c5c6bf1629458973d27d561515b159www800-800"
	}, {
		"product_id": "3420549757309946318",
		"product_name": "简优 2020新款法式复古一字肩长裙性感收腰超仙甜美气质连衣裙女",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/72595e8809d4fac2c2e89e7904a64b4cd4d87dffwww900-1198"
	}, {
		"product_id": "3421647256720437539",
		"product_name": "欧洲站2020新款女装慵懒风显瘦荷叶边imiss赫本小黑裙黑色连衣裙",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/fdd336309bd1c3c146b8efb9207c675d9f052021www800-800"
	}, {
		"product_id": "3419421537978215566",
		"product_name": "卫衣",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/FjWh4lQ52hVXz7Ouemw5MepF53lEwww1100-1390"
	}, {
		"product_id": "3422011902858028524",
		"product_name": "气质时尚女装碎花修身显瘦裙子...",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/0c71ce6acb4e3b508e0d30042b1a94262818ab41www800-800"
	}, {
		"product_id": "3423860246328803866",
		"product_name": "【限量疯抢】HUAWEI/华为Mate30##8+128GB##全网通4G智能手机麒麟990徕卡拍照手机旗舰官方正品",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/8fa4a6537c6711b64506d213a2b8e017814068c6www800-800"
	}, {
		"product_id": "3422043464425172747",
		"product_name": "测试草稿箱--气质时尚女装碎花修身显瘦裙子",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/0c71ce6acb4e3b508e0d30042b1a94262818ab41www800-800"
	}, {
		"product_id": "3423891265228517513",
		"product_name": "【限量疯抢】HUAWEI/华为Mate30##8+128GB##全网通4G智能手机麒麟990徕卡拍照手机旗舰官方正品",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/8fa4a6537c6711b64506d213a2b8e017814068c6www800-800"
	}, {
		"product_id": "3423892242341956788",
		"product_name": "【限量疯抢】HUAWEI/华为Mate30##8+128GB##全网通4G智能手机麒麟990徕卡拍照手机旗舰官方正品",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/8fa4a6537c6711b64506d213a2b8e017814068c6www800-800"
	}, {
		"product_id": "3424417187622970691",
		"product_name": "花花公子男潮鞋夏季新款男鞋2020运动鞋网鞋透气网面鞋跑步男凉鞋",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/d0e60a6e64ad820cc4d73f5a7743e79c57bb9c96www800-800"
	}, {
		"product_id": "3423895929571394818",
		"product_name": "花花公子男潮鞋夏季新款男鞋2020运动鞋网鞋透气网面鞋跑步男凉鞋",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/d0e60a6e64ad820cc4d73f5a7743e79c57bb9c96www800-800"
	}, {
		"product_id": "3423897473603759258",
		"product_name": "花花公子男潮鞋夏季新款男鞋2020运动鞋网鞋透气网面鞋跑步男凉鞋",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/d0e60a6e64ad820cc4d73f5a7743e79c57bb9c96www800-800"
	}, {
		"product_id": "3424447796361703269",
		"product_name": "花花公子男潮鞋夏季新款男鞋2020运动鞋网鞋透气网面鞋跑步男凉鞋",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/d0e60a6e64ad820cc4d73f5a7743e79c57bb9c96www800-800"
	}, {
		"product_id": "3424451376208562748",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424451754165726036",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424469156727270999",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424452080591605006",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424468516777157418",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424452192260748469",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424469820299717169",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424471261907176430",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424471826049459219",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424469835986394211",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424472725845114576",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424473877550637883",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424472478884461286",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424472159555341900",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}, {
		"product_id": "3424473055056010477",
		"product_name": "碎花雪纺连衣裙女夏装2020新款气质女神范收腰显瘦V领胖mm仙女裙",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/14858ff195310f70285887ab14802aa03d68f08bwww800-800"
	}]
	var arr = [{
		"product_id": "3419420455646431007",
		"product_name": "男装 工装七分裤(卷边) 425146 优衣库UNIQLO",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/049963cc35d7dc71728b72b6f5a1886107d5c9b0www1000-1000",
		"product_price": 249,
		"is_select": 1
	},
	{
		"product_id": "3420553588420785995",
		"product_name": "简优 2020新款法式复古一字肩长裙性感收腰超仙甜美气质连衣裙女",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/72595e8809d4fac2c2e89e7904a64b4cd4d87dffwww900-1198",
		"product_price": 389,
		"is_select": 1
	},
	{
		"product_id": "3421990680183064559",
		"product_name": "v领白色衬衣女短袖百搭气质工作服职业工装OL面试面试公务员衬衫",
		"product_img": "https://sf6-ttcdn-tos.pstatp.com/obj/temai/ccaa2ebb39c5c6bf1629458973d27d561515b159www800-800",
		"product_price": 129,
		"is_select": 1
	},
	{
		"product_id": "3420549757309946318",
		"product_name": "简优 2020新款法式复古一字肩长裙性感收腰超仙甜美气质连衣裙女",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/72595e8809d4fac2c2e89e7904a64b4cd4d87dffwww900-1198",
		"product_price": 389,
		"is_select": 1
	},
	{
		"product_id": "3421647256720437539",
		"product_name": "欧洲站2020新款女装慵懒风显瘦荷叶边imiss赫本小黑裙黑色连衣裙",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/fdd336309bd1c3c146b8efb9207c675d9f052021www800-800",
		"product_price": 668,
		"is_select": 1
	},
	{
		"product_id": "3419421537978215566",
		"product_name": "卫衣",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/FjWh4lQ52hVXz7Ouemw5MepF53lEwww1100-1390",
		"product_price": 99,
		"is_select": 1
	},
	{
		"product_id": "3422011902858028524",
		"product_name": "气质时尚女装碎花修身显瘦裙子...",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/0c71ce6acb4e3b508e0d30042b1a94262818ab41www800-800",
		"product_price": 268,
		"is_select": 1
	},
	{
		"product_id": "3423860246328803866",
		"product_name": "【限量疯抢】HUAWEI/华为Mate30##8+128GB##全网通4G智能手机麒麟990徕卡拍照手机旗舰官方正品",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/8fa4a6537c6711b64506d213a2b8e017814068c6www800-800",
		"product_price": 3599,
		"is_select": 1
	},
	{
		"product_id": "3422043464425172747",
		"product_name": "测试草稿箱--气质时尚女装碎花修身显瘦裙子",
		"product_img": "https://sf3-ttcdn-tos.pstatp.com/obj/temai/0c71ce6acb4e3b508e0d30042b1a94262818ab41www800-800",
		"product_price": 268,
		"is_select": 1
	},
	{
		"product_id": "3423891265228517513",
		"product_name": "【限量疯抢】HUAWEI/华为Mate30##8+128GB##全网通4G智能手机麒麟990徕卡拍照手机旗舰官方正品",
		"product_img": "https://sf1-ttcdn-tos.pstatp.com/obj/temai/8fa4a6537c6711b64506d213a2b8e017814068c6www800-800",
		"product_price": 3599,
		"is_select": 1
	}
	]

	var newData = [{
		product_id: '1'
	},
	{
		product_id: '2'
	},
	{
		product_id: '3'
	},
	{
		product_id: '4'
	},
	{
		product_id: '5'
	},
	{
		product_id: '6'
	},
	{
		product_id: '7'
	},
	{
		product_id: '8'
	},
	{
		product_id: '9'
	},
	{
		product_id: '10'
	},
	{
		product_id: '11'
	},
	{
		product_id: '12'
	},
	{
		product_id: '13'
	}, {
		product_id: '14'
	},
	{
		product_id: '15'
	},
	{
		product_id: '16'
	},
	{
		product_id: '17'
	},
	{
		product_id: '18'
	},
	{
		product_id: '19'
	},
	]

	var newArr = [
		{
			product_id: '1'
		},
		{
			product_id: '2'
		},
		{
			product_id: '3'
		},
		{
			product_id: '4'
		},
		{
			product_id: '5'
		},
		{
			product_id: '6'
		},
		{
			product_id: '7'
		},
		{
			product_id: '8'
		},
		{
			product_id: '9'
		},
		{
			product_id: '10'
		}
	]
	function removeObject(data, arr) {
		const arrData = [...data]
		console.log('arr', arr)
		Array.prototype.indexOf = function (val) {
			for (var i = 0; i < this.length; i++) {
				if (this[i] == val) return i;
			}
			return -1;
		};
		Array.prototype.remove = function (val) {
			var index = this.map((o) => o.product_id).indexOf(val);
			console.log('this.', this)
			if (index > -1) {
				this.splice(index, 1);
			}
		};
		arrData.map((iten, i) => {
			// console.log('arr.map((o) => o.product_id).indexOf(iten.product_id)', arr.map((o) => o.product_id)
			// 	.indexOf(iten.product_id))
			console.log(i)
			console.log('iten.product_id', iten.product_id)
			if (arr.map((o) => o.product_id).indexOf(iten.product_id) != -1) {
				console.log("12 :>> ", iten);
				data.remove(iten.product_id);
			}

		});
		return data;
	}
	// var text = removeObject(data, arr)
	var text = removeObject(newData, newArr)
	console.log('text', text)




	//判断图片是否存在
	var imgurl = 'http://img.alicdn.com/imgextra/i3/2207455996208/O1CN01PtHdaC1vjJOcZi3yd_!!2207455996208.jpg'
	function img_SET() {
		// is_img_url(imgurl).then(()=>{
		// 	console.log('有效链接')
		// }).catch(()=>{
		// 	console.log('有效链接-------')
		// headers: {
				// 'Accept-Encoding': 'gzip, deflate'
			// },
		// })
		$.ajax({
			url: imgurl, method: "GET",
			encoding: null,
			 success: function (data) {
				console.log('data', data)
			}, error: function (err) {
				console.log('data', err)
			}
		})
	}

         //找重复项最多的字符个数
        // demo("aabbabbbbbcck");
		var str = '{订单编号}，{下单时间}的撒的撒的撒的萨达所大所多{订单编号}';
		var index = str.indexOf('{订单编号}'); // 字符出现的位置
		console.log('index',index)
		var num = 0; // 这个字符出现的次数
		while(index !== -1) {
			console.log(index); // 打印字符串出现的位置
			num++; // 每出现一次 次数加一
			index = str.indexOf('{订单编号}',index + 1); // 从字符串出现的位置的下一位置开始继续查找
		}
		console.log('f一共出现了' + num + '次');


</script>